package com.afd.ozblip.share;

import org.json.JSONObject;



public class ShareParseJson {

	/**
	 * 解析新浪用户JSON数据
	 * 
	 * @param dataByte
	 *            数据字节
	 * @return
	 */
	public WeiBoUserEntity parseSinaUserJson(String resultJson) {
		WeiBoUserEntity userInfo = null;
		try {
			JSONObject userJson = new JSONObject(resultJson);
			userInfo = new WeiBoUserEntity();
			userInfo.setUserName(userJson.getString("name"));
		} catch (Exception e) {
			e.printStackTrace();
			userInfo = null;
		}
		return userInfo;
	}

	/**
	 * 解析腾讯用户JSON数据
	 * 
	 * @param dataByte
	 *            数据字节
	 * @return
	 */
	public WeiBoUserEntity parseQQUserJson(String resultJson) {
		WeiBoUserEntity userInfo = null;
		try {
			JSONObject dataJson = new JSONObject(resultJson);
			JSONObject userJson = dataJson.getJSONObject("data");
			userInfo = new WeiBoUserEntity();
			userInfo.setUserName(userJson.getString("nick"));
		} catch (Exception e) {
			e.printStackTrace();
			userInfo = null;
		}
		return userInfo;
	}
}
